<template>
  <div>专辑内容</div>

  <li v-for="item in list" :key="item.id" @click="addSong(item)">
    <img :src="item.pic" alt="" width="50" height="50" />
    <p>{{ item.name }}</p>
  </li>
</template>
<script setup>
import { getAlbum } from '@/api'

import { ref, onMounted, toRefs } from 'vue'
import { useRoute } from 'vue-router'

import { usePlayer } from '@/stores/player'

const { addSong } = toRefs(usePlayer())

const route = useRoute()
let list = ref([])
onMounted(() => {
  let id = route.query.id
  getAlbum({
    id
  }).then((res) => {
    console.log(res)
    list.value = res.result
  })
})
</script>
